/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HomePanel.java
 *
 * Created on Mar 13, 2011, 9:26:07 AM
 */

package sample.panels;

import sample.model.User;

/**
 *
 * @author nicolas
 */
public class HomePanel extends javax.swing.JPanel {
    private User _user;

    /** Creates new form HomePanel */
    public HomePanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPane = new javax.swing.JTabbedPane();
        tab1 = new javax.swing.JPanel();
        jSlider1 = new javax.swing.JSlider();
        userName = new javax.swing.JLabel();
        tab2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();

        setName("Form"); // NOI18N

        tabbedPane.setName("tabbedPane"); // NOI18N

        tab1.setName("tab1"); // NOI18N

        jSlider1.setName("jSlider1"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sample.SampleApp.class).getContext().getResourceMap(HomePanel.class);
        userName.setText(resourceMap.getString("userName.text")); // NOI18N
        userName.setName("userName"); // NOI18N

        org.jdesktop.layout.GroupLayout tab1Layout = new org.jdesktop.layout.GroupLayout(tab1);
        tab1.setLayout(tab1Layout);
        tab1Layout.setHorizontalGroup(
            tab1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tab1Layout.createSequentialGroup()
                .add(tab1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(tab1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jSlider1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(tab1Layout.createSequentialGroup()
                        .add(53, 53, 53)
                        .add(userName)))
                .addContainerGap(185, Short.MAX_VALUE))
        );
        tab1Layout.setVerticalGroup(
            tab1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tab1Layout.createSequentialGroup()
                .add(jSlider1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(27, 27, 27)
                .add(userName)
                .addContainerGap(182, Short.MAX_VALUE))
        );

        tabbedPane.addTab(resourceMap.getString("tab1.TabConstraints.tabTitle"), tab1); // NOI18N

        tab2.setName("tab2"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList1.setName("jList1"); // NOI18N
        jScrollPane1.setViewportView(jList1);

        org.jdesktop.layout.GroupLayout tab2Layout = new org.jdesktop.layout.GroupLayout(tab2);
        tab2.setLayout(tab2Layout);
        tab2Layout.setHorizontalGroup(
            tab2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tab2Layout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(336, Short.MAX_VALUE))
        );
        tab2Layout.setVerticalGroup(
            tab2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(tab2Layout.createSequentialGroup()
                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(114, Short.MAX_VALUE))
        );

        tabbedPane.addTab(resourceMap.getString("tab2.TabConstraints.tabTitle"), tab2); // NOI18N

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JPanel tab1;
    private javax.swing.JPanel tab2;
    private javax.swing.JTabbedPane tabbedPane;
    private javax.swing.JLabel userName;
    // End of variables declaration//GEN-END:variables

    public void setUser(User user) {
        _user = user;
        userName.setText(user.getName());
    }

}
